﻿using System;
using System.Collections.Generic;
using System.Text;
using ECC_EXT_Entity;
using NHibernate;

namespace ECC_EXT_DAO.Dao
{
    public class DICCategoryDao:DaoBase
    {
        public void SaveOrUpdate(DICCategoryEntity _dicCategoryEntity)
        {
            using (ISession session = this.SessionFactory.OpenSession())
            {
                session.BeginTransaction();
                session.SaveOrUpdate(_dicCategoryEntity);
                session.Transaction.Commit();
            }
        }

        public int DeleteAll()
        {
            int res = 0;
            using (ISession session = this.SessionFactory.OpenSession())
            {
                session.BeginTransaction();
                res =
                session.CreateSQLQuery(@"delete from [T_ECC_EXT_DIC_Category]").ExecuteUpdate();
                session.Transaction.Commit();
            }
            return res;
        }
    }
}
